package com.gui.profile.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.gui.entity.BigEntity;
import com.gui.profile.service.OomService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Service
public class OomServiceImpl implements OomService {

    @Override
    public void oom() {
        List<BigEntity> entityList = new ArrayList<>(1024);
        int index = 0;
        while (true) {
            if ("1".equals(UUID.randomUUID().toString())) {
                break;
            }
            BigEntity bigEntity = new BigEntity();
            bigEntity.setName(RandomUtil.randomString(10));
            bigEntity.setId(index++);
            bigEntity.setAttachment(new byte[1024 * 1024]);
            entityList.add(bigEntity);
        }
    }
}
